<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="keywords" content="github加速,代理加速下载,github代理,github镜像站,github免费加速下载"/>
    <meta name="description"
          content="解决因为网络环境问题github下载文件慢的问题，网站由个人开发者维护，为有需要的小伙伴提供一个应急解决方案，可以通过github加速站点访问浏览github网站的内容（不能登录）"/>
    <title>github免费加速下载|github镜像加速|代理下载加速</title>
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport">
    <meta name="baidu-site-verification" content="codeva-whKMaMINKl" />
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.3/js/bootstrap.min.js"></script>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div style="position: absolute;top: 0;width: 100%">
    <div aria-live="polite" aria-atomic="true" class="d-flex justify-content-center align-items-center" style="height: 200px;">
        <div id="liveToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true" data-delay="2000">
            <div class="toast-header" style="color: red">
                <svg class="bi bi-exclamation-triangle-fill" width="2em" height="2em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
                    <path fill-rule="evenodd" d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0 0 1.1 0l.35-3.507A.905.905 0 0 0 8 5zm.002 6a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/>
                </svg>
            </div>
            <div id="alertText" style="padding: 10px 10px;background: #d971b2; border-radius: 0 0 4px 4px">
                错误信息
            </div>
        </div>
    </div>
</div>

        <div class="jumbotron jumbotron-fluid">
            <div class="container">
                <img src="" alt="编码鸭"/>
                <p class="lead">公众号"编码鸭"获取验证码,免费使用加速功能。</p>
            </div>
        </div>

        <div class="modal-body col-sm-12 col-lg-4 col-md-4" style=";margin: 0 auto;">
<!--                <span class="input-group-addon" >验证码：</span>-->
<!--                <hr>-->
                <input id="code" name="code" type="text" class="form-control" placeholder="输入验证码" aria-describedby="sizing-addon2">
            <div style="display: flex;flex-direction: column;align-items: flex-end;">
                <button id="loginSubmit"  class="btn btn-success">
                    <span id="submitLoading" class="spinner-border spinner-border-sm" role="status"  aria-hidden="true"></span>
                    提交
                </button>
            </div>

        </div>

        <script>
            $("#submitLoading").hide();
            $("#loginSubmit").click(function (){
                const code = $("#code").val();
                if(code === "")  {
                    showToast("验证码为空",2000);
                    return;
                }
                $("#submitLoading").show();
                $("#loginSubmit").prop("disabled",true)
                $.ajax({
                        url:"/wxapi/verity/code",
                        type: "post",
                        dataType: "json",
                        data: {
                            'code':code
                        },
                        success(res) {
                            console.log(res)
                            if (res.code === 200) {
                                window.location.href = "/"
                            } else if (res.code === 202) {
                                // alert("验证失败，code不存在");
                                showToast("验证失败，code不存在",2000);
                            } else {
                                // alert("验证失败");
                                showToast("验证失败",2000);
                            }
                        },
                        error() {
                            showToast("请求失败",2000);
                        },
                        complete(xhr, status) {
                            console.log("complete");
                            $("#submitLoading").hide();
                            $("#loginSubmit").prop("disabled",false)
                        }

                    }
                )
            })

            function showToast(text,time) {
                $("#alertText").text(text);
                $("#liveToast").addClass("show");
                setTimeout(()=>{
                    $("#liveToast").removeClass("show");
                },time)
            }
        </script>

<style>
    #loginSubmit {
        margin-top: 10px;
        width: 6rem;
    }
</style>
</body>
</html>